<?php 
namespace app\admin\validate;
use think\Validate;

	class Admin extends Validate
	{
		//当前验证规则
		protected $rule=[
			'id'=>'require',
			'username'=>'require|unique:admin,user_name,admin_id',
			'pwd'=>'require|length:6,16',
			'repwd'=>'require|confirm:pwd',
			'code'=>'require|captcha',
		];
		//验证提示信息
		protected $message = [
			'id'=>'登录名不能为空',
			'pwd'=>[
				'require'=>'密码不能为空',
				'length' =>'密码为6~16位',
			],
			'repwd'=>[
				'require'=>'确认密码不能为空',
				'confirm' =>'两次密码不一致',
			],
			'code'=>[
				'require'=>'验证码不能为空',
				'captcha' =>'验证码错误',
			],
			'username'=>[
				'require'=>'用户名不能为空',
				'unique' =>'用户名已存在'
			],
		];

		//add 新增   edit 修改
		protected $scene = [
			'login'=> ['id','pwd','code'],
			'add'  => ['username','repwd','pwd'],
			'edit2' => ['username','repwd','pwd'],
			'edit1' => ['username'],
		];
	}